<!-- 自定义用户输入(编号、账号)  -->
<template>
  <input-with-helper showLabel v-bind="$attrs" v-on="$listeners" v-model="childValue" dialogTitle="选择用户" dialogWidth="600px"
    :searchCriteria="[
      { label: '工号', prop: 'employeeId' },
      { label: '姓名', prop: 'name' },
      { label: '部门', prop: 'deptName' },
    ]" :columns="[
      {
        title: '工号',
        field: 'employeeId',
        align: 'center',
        sortable: true,
      },
      { title: '姓名', field: 'name', sortable: true },
      { title: '部门', field: 'deptName', sortable: true },
    ]" :defaultSort="{
      field: 'employeeId',
      order: 'asc',
    }" :searchMethod="listTeacher" :valueProps="valueProps">
  </input-with-helper>
</template>

<script>
import { listTeacher } from "@/api/stuCQS/basedata/teacher";
import InputWithHelper from "@/components/ValueHelper/index";

export default {
  name: "UserSelect",
  components: {
    InputWithHelper,
  },
  props: {
    value: null,
    valueProps: {
      type: Object,
      default: () => {
        return {
          value: "employeeId",
          label: "name",
        };
      },
    },
  },
  data() {
    return {
      //选择值
      childValue: this.value,
    };
  },
  watch: {
    //父组件值变更
    value(val) {
      this.childValue = val;
    },
  },
  methods: {
    listTeacher,
  },
};
</script>